<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>

    <button onclick="vote('up')">up</button>
    <button onclick="vote('down')">down</button>
    <button onclick="vote('left')">left</button>
    <button onclick="vote('right')">right</button>


    <script>
        var ws = new WebSocket('ws://47.98.50.245/message');
        ws.onmessage = function (event) {
            /* 服务器端向客户端发送数据时，自动执行 */
            // {'cid':cid,'count':new}
           <!--   var response = JSON.parse(event.data); -->
            <!-- $('#id_'+response.cid).find('span').text(response.count); --> -->
			alter('123')

        };

        function vote(cid) {
            ws.send(cid)  // 发送信息
        }
    </script>
</body>
</html>